/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import Utility.PrimaryKeyReturnValue;
import constants.CommonConstants;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import vo.rb_manufacturing;

/**
 *
 * @author Shuhail
 */
public class rb_manufacturing_persist {
    
    Session sess=null;
    Transaction tx=null;
    public rb_manufacturing_persist() {
    
        SessionFactory sf=new Configuration().configure().buildSessionFactory();
        sess=sf.openSession();
        tx=sess.beginTransaction();
    }
    
    public static rb_manufacturing_persist getInstance() {
        return new rb_manufacturing_persist();
    }
    
    public boolean insert(rb_manufacturing manu) {
        
        rb_manufacturing man=new rb_manufacturing();
        PrimaryKeyReturnValue pkr=PrimaryKeyReturnValue.getInstance();

        Long count=(Long)sess.createQuery("select count(*) from rb_manufacturing").uniqueResult();
        System.out.println(count.intValue());
       System.out.println(new PrimaryKeyReturnValue().getValueCorrespondingToColumn(CommonConstants.MANUFACTURE_CHAR,count.intValue()));
       // sess.save(manu);
       // tx.commit();
        return true;
    }
    
    
}
